package notice

import (
	"github.com/spf13/viper"
	"go.uber.org/zap"
)

type Noticer interface {
	Name() string
	Status() bool
	SetTpl(string)
	Send(string)
}

func NewNotice(logger *zap.Logger, conf *viper.Viper) Noticer {
	var notice Noticer
	method := conf.GetString("notice.method")
	switch method {
	case "wxwork":
		notice = NewWXWork(logger, conf)
	case "mail", "":
		notice = NewMail(logger, conf)
	default:
		logger.Fatal("[消息通知]不支持的通知方式", zap.String("method", method))
	}

	return notice
}

type Notice struct {
	Noticer
}
